//
// Created by Alex on 2021/12/1.
//

#include "GeoPoint.h"

GeoPoint::GeoPoint(){

}

GeoPoint::GeoPoint(LonLat p){
    this->pt = p;
}

void GeoPoint::addPoint(LonLat p) {
    this->pt = p;
}

void GeoPoint::addProperties(QString key, QVariant value){
    this->properties.insert(key,value);
}

QVariant GeoPoint::getPropertiesValue(QString key){
    if(properties.contains(key)){
        return properties.value(key);
    }
    else{
        return "NULL";
    }
}

void GeoPoint::setStyle(GeoStyle * style){
    this->pointStyle = style;
}

void GeoPoint::getScale()
{
    Xmin=pt.getLongitude();
    Xmax=pt.getLongitude();
    Ymin=pt.getLatitude();
    Ymax=pt.getLatitude();
    mmRect = GeoScale(Xmin-0.1,Ymin-0.1,Xmax+0.1,Ymax+0.1);
}

LonLat GeoPoint::getData()
{
    return this->pt;
}

double GeoPoint::getR()
{
    if(pointStyle != nullptr)
        return pointStyle->fillCcolor.red()/255.0;
    return 1.0;
}

double GeoPoint::getG()
{
    if(pointStyle != nullptr)
        return pointStyle->fillCcolor.green()/255.0;
    return 0.0;
}

double GeoPoint::getB()
{
    if(pointStyle != nullptr)
        return pointStyle->fillCcolor.blue()/255.0;
    return 0.0;
}







